.\"   $Id: addlosig.3,v 1.1 2002/03/08 13:51:01 fred Exp $
.\" @(#)addlosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
addlosig
.XE
.XS2 \n%
.ti 0.2i
addlosig
.XE2 \}
.TH ADDLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS"
.SH NAME
addlosig \- create a logical signal
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mlo.h"
losig_list \(**addlosig(ptfig, index, namechain, type)
lofig_list \(**ptfig;
long index;
chain_list \(**namechain;
char type;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIptfig\fP
Pointer to the figure in which the signal should be added
.TP
\fIindex\fP
Signal index
.TP
\fInamechain\fP
List of names of the signal
.TP
\fItype\fP
Signal type
.SH DESCRIPTION
\fBaddlosig\fP creates a new signal, and adds it to the
list of signals pointed to by \fIptfig\->LOSIG\fP. The new signal is 
added in front of the list, and becomes itself the list head.
.br
The \fItype\fP parameter can take two values :
.RS
.TP 20
\fBEXTERNAL\fP
The signal is attached to at least one connector of the figure.
.TP
\fBINTERNAL\fP
The signal is only attached to instance or transistor connector.
.RE
The \fIindex\fP and \fItype\fP arguments fill the \fIINDEX\fP and
\fITYPE\fP fields of the \fBlosig\fP(3) structure. The index
is the signal identifier, so it should be unique at a given hierarchical level.
.br
The \fInamechain\fP argument is a list of names, given in a \fBchain_list\fP.
See \fBchain\fP(3) for details. 
.SH RETURN VALUE
\fBaddlosig\fP returns a pointer to the newly created signal.
.SH ERRORS
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** addlosig impossible signal \fIindex\fP already exist
in figure \fIptfig\->NAME\fP"
.ft R
.RS
The \fIindex\fP is already used in an other signal, and since it's the signal
identifier, it can't be.
.RE
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mlo.h"
losig_list \(**merge_and_create(pt, s0, s1) /\(** merge two signal in a third \(**/
lofig_list \(**pt;
losig_list \(**s0, \(**s1;
{
chain_list \(**c;
losig_list \(**s;
long max_index;
	/\(** merge names \(**/
	for (c = s0\->NAMECHAIN; c; c = c\->NEXT)
		s1\->NAMECHAIN = addchain(s1\->NAMECHAIN, c);
	/\(** find maximum index \(**/
	for (s = pt\->LOSIG; s; s = s\->NEXT)
		if (max_index < s\->INDEX)
			max_index = s\->INDEX;
	s = addlosig(pt, ++max_index, s1\->NAMECHAIN,
			s0\->TYPE == EXTERNAL || s1\->TYPE == EXTERNAL ?
			EXTERNAL : INTERNAL);
	dellosig(pt, s0);
	dellosig(pt, s1);
	return s;
}
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR lofig (3),
.BR losig (3),
.BR getlosig (3),
.BR dellosig (3).


.so man1/alc_bug_report.1

